<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div>
    <ul>
        <!--v-for:循环遍历指令,将v-for写在需要重复生成的元素中-->
        <li v-for="name in arr">{{name}}</li>
    </ul>
    <hr>
    <table border="1">
        <tr>
            <th>编号</th><th>商品名称</th><th>商品价格</th><th>商品库存</th>
        </tr>
        <tr v-for="(item,i) in itemArr" :key="i">
            <td>{{i+1}}</td><td>{{item.title}}</td><td>{{item.price}}</td><td>{{item.num}}</td>
        </tr>

    </table>
</div>
<script src="../js/vue.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data() {
            return {
                arr:["刘备","关羽","张飞"],
                itemArr:[{title:"华为手机",price:"5000",num:100},
                    {title:"小米电视",price:"3000",num:200},
                    {title:"联想笔记本",price:"4000",num:300}]
            }
        },
    })
</script>
</body>
</html>